from datetime import date

# 请在此输入您的代码
n, M, k = map(int, input().split())
board = []
for _ in range(n):
    m, d, v = map(int, input().split())
    days = (date(year=2025, month=m, day=d) - date(year=2025, month=1, day=1)).days
    board.append([days, v])
dp = [[0 for _ in range(2)] for _ in range(M + 1)]  # 拿不拿
